"use client";
import { Route, Routes } from "react-router-dom";
import { lazy, Suspense, useEffect, useState } from "react";
// import axios from "axios";
import Loay from "./shou/loay";
import RegisterLoginForm from './components/RegisterLoginForm';
const Xiang = lazy(() => import("./shou/shouye"));
const Sear = lazy(() => import("./shou/search"));
const Xian = lazy(() => import("./shou/xianshi"));
const Xiangq= lazy(() => import("./shou/xiangq"));
const Tui=lazy(()=>import("./shou/tuij"));
const Cate = lazy(()=>import("./components/cate"));
const Detail = lazy(()=>import("./components/detail"));
import Jie from "./components/jie.jsx";
import Dizhi from "./components/dizhi.jsx";
import Zhi from "./components/zhi.jsx";
import Gou from "./components/gou.jsx";
import AddressManagement from "./components/AddressManagement.tsx";
import Add from "./components/add.jsx";

export type Medicine = {
  id: string;
  name: string;
  price: number;
  description: string;
  image: string;
  category: string;
  brand: string;
  dosage: string;
  ingredients: string;
  sideEffects: string;
  storage: string;
  expiryDate: string;
};


export default function App1() {
  
  return (
    <>
      <Suspense fallback={<div>Loading...</div>}>
        <Routes>
          <Route path="/" element={<RegisterLoginForm />} />
          <Route path="/layout" element={<Loay></Loay>}>
            <Route path="/layout/shouye" element={<Xiang />} />
            <Route path="/layout/cate" element={<Cate />} />
            <Route
              path="/layout/gon"
              element={
                <div style={{ padding: 32, textAlign: "center" }}>消息页面</div>
              }
            />
            <Route
              path="/layout/wode"
              element={
                <div style={{ padding: 32, textAlign: "center" }}>我的页面</div>
              }
            />
            <Route
              path="/layout/cart"
              element={
                // <div style={{ padding: 32, textAlign: "center" }}>
                //   购物车页面
                // </div>
                <Gou />
              }
            />
          </Route>
          <Route path="/tui" element={<Tui />} />
          <Route path="/xiangq/:id" element={<Xiangq />} />
          <Route path="/detail/:id" element={<Detail />} />
          <Route path="/xian" element={<Xian />} />
          <Route path="/sear" element={<Sear />} />
          <Route path="/cart" element={<Gou />} />
          <Route path="/jie" element={<Jie />} />
          <Route path="/dizhi" element={<Dizhi />} />
          <Route path="/zhi" element={<Zhi />} />
          <Route path="/address-management" element={<AddressManagement />} />
          <Route path="/add" element={<Add />} />
        </Routes>
      </Suspense>
    </>
  );
}

